package com.hyl.service;


import com.hyl.annotation.OprLogic;
import com.hyl.mapper.UserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * UserService
 *
 * @author hyl
 * @date 2025-06-23
 */
@Service
public class UserService {

    Logger logger = LoggerFactory.getLogger(UserService.class);

    private UserMapper userMapper;

    @OprLogic(value = "新增",order = 1)
    public int insert(){
        //调用
        if (userMapper != null) {  //error
            userMapper.insert();
        }
        //结果 ==》after

        //无论错误=》returning
        return 1;
    }


    @OprLogic(value = "修改",order = 2)
    public int update(){
        logger.info("修改");
        if (userMapper != null) {
            userMapper.update();
        }
        return 1;
    }


    @OprLogic(value = "删除",order = 3)
    public int delete(){
        logger.info("删除");
        if (userMapper != null) {
            userMapper.delete();
        }
        return 1;
    }
}
